<template>
  <AvicModal :visible="true" title="图标选择" width="960px" height="520px" :centered="true" @cancel="closeModal">
    <AvicIconList :copy-type="props.copyType" @select="chooseIcon" />
    <template #footer>
      <a-button title="确定" type="primary" @click="saveForm">保存</a-button>
      <a-button title="返回" type="primary" ghost @click="closeModal">返回</a-button>
    </template>
  </AvicModal>
</template>
<script lang="ts" setup>
import AvicIconList from './AvicIconList.vue';
/**
 * 组件回调事件
 * close 关闭事件回调
 * choose 保存事件回调
 */
const emit = defineEmits(['close', 'choose']);
const props = defineProps({
  copyType: { type: Boolean, default: false }
});
const choosedIcon = ref('');
/**
 * 选择
 * @param symbol 选择的数据对象
 */
function chooseIcon(symbol) {
  choosedIcon.value = symbol;
}
/** 保存 */
function saveForm() {
  emit('choose', choosedIcon.value);
}
/** 关闭 */
function closeModal() {
  emit('close');
}
</script>
